--------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  C:\Users\wb614536\Downloads\replication\replication\code\../outputs/03_OutcomeConstruction_log.txt
  log type:  text
 opened on:  25 Jun 2026, 12:48:30
r; t=0.01 12:48:30

. 
. di "=================================================================="
==================================================================
r; t=0.00 12:48:30

. di "  03_OutcomeConstruction.do"
  03_OutcomeConstruction.do
r; t=0.00 12:48:30

. di "  Date: $S_DATE  Time: $S_TIME"
  Date: 25 Jun 2026  Time: 12:48:30
r; t=0.00 12:48:30

. di "=================================================================="
==================================================================
r; t=0.00 12:48:30

. 
. use "$clean/PEP_Analysis_Sample.dta", clear
(PEP analysis sample (JEEA-style: clear trt, date present))
r; t=0.09 12:48:30

. 
. /*==============================================================================
>   PART 1: HELPER — control-mean standardization within a wave
> ==============================================================================*/
. 
. * For each (variable, wave) pair, build a standardized version using the
. * control group's mean and SD within that wave. Stored as `<dst>` in the
. * dataset (filled for both waves so a single variable serves both).
. 
. capture program drop _jee_std_bywave
r; t=0.00 12:48:30

. program define _jee_std_bywave
  1.     args src dst
  2.     capture confirm variable `src'
  3.     if _rc {
  4.         di "  Source variable `src' not found — skipping"
  5.         exit
  6.     }
  7.     capture drop `dst'
  8.     gen `dst' = .
  9.     forvalues w = 1/2 {
 10.         qui sum `src' if pep == 0 & wave_num == `w'
 11.         if r(N) > 0 & r(sd) > 0 {
 12.             replace `dst' = (`src' - r(mean)) / r(sd) if wave_num == `w'
 13.         }
 14.     }
 15. end
r; t=0.00 12:48:30

. 
. /*==============================================================================
>   PART 2: JEEA-STYLE INDICES (per wave)
> ==============================================================================*/
. 
. di ""

r; t=0.00 12:48:30

. di "--- Building JEEA-style indices (control-mean std, by wave) ---"
--- Building JEEA-style indices (control-mean std, by wave) ---
r; t=0.00 12:48:30

. 
. * Drop existing index variables (in case do-file is re-run on saved data)
. foreach v in jeea_index_wellbeing jeea_index_labor jeea_index_services ///
>              index_discrim index_remit index_fin_access index_digital {
  2.     capture drop `v'
  3. }
r; t=0.00 12:48:30

. 
. * Well-being index: consumption + labor income + employed
. _jee_std_bywave gasto_capita      jstd_consumption
(13,580 missing values generated)
(8,222 real changes made)
(5,097 real changes made)
r; t=0.01 12:48:30

. _jee_std_bywave labour_income     jstd_income
(13,580 missing values generated)
(6,558 real changes made)
(4,433 real changes made)
r; t=0.01 12:48:30

. _jee_std_bywave employed          jstd_employed
(13,580 missing values generated)
(4,109 real changes made)
(2,511 real changes made)
r; t=0.01 12:48:30

. egen jeea_index_wellbeing = rowmean(jstd_consumption jstd_income jstd_employed)
r; t=0.02 12:48:30

. label var jeea_index_wellbeing "Well-being index (JEEA std, by wave)"
r; t=0.00 12:48:30

. 
. * Labor index: formal + log hours
. _jee_std_bywave formal            jstd_formal
(13,580 missing values generated)
(2,438 real changes made)
(1,593 real changes made)
r; t=0.01 12:48:30

. _jee_std_bywave hora_semana       jstd_hours
(13,580 missing values generated)
(2,368 real changes made)
(1,522 real changes made)
r; t=0.01 12:48:30

. egen jeea_index_labor = rowmean(jstd_formal jstd_hours)
(9,549 missing values generated)
r; t=0.01 12:48:30

. label var jeea_index_labor "Labor outcomes index (JEEA std, by wave)"
r; t=0.00 12:48:30

. 
. * Service access index: sisben + subs + govtr.
. * Banking is deliberately EXCLUDED: bank-account access is a one-time
. * mechanical onboarding effect of regularization whose eligible-ineligible
. * gap closes by Wave 2, so it belongs with the financial-access index
. * (built below) rather than the durable public-services margins. Excluding
. * it makes the service access index grow in the medium run.
. _jee_std_bywave sisben            jstd_sisben
(13,580 missing values generated)
(8,185 real changes made)
(5,085 real changes made)
r; t=0.01 12:48:30

. _jee_std_bywave subs              jstd_subs
(13,580 missing values generated)
(8,228 real changes made)
(4,901 real changes made)
r; t=0.01 12:48:30

. _jee_std_bywave govtr             jstd_govtr
(13,580 missing values generated)
(8,226 real changes made)
(5,340 real changes made)
r; t=0.01 12:48:30

. egen jeea_index_services = rowmean(jstd_sisben jstd_subs jstd_govtr)
(6 missing values generated)
r; t=0.01 12:48:30

. label var jeea_index_services "Service access index (JEEA std, by wave)"
r; t=0.00 12:48:30

. 
. drop jstd_*
r; t=0.00 12:48:30

. 
. di "  Added: jeea_index_wellbeing, jeea_index_labor, jeea_index_services"
  Added: jeea_index_wellbeing, jeea_index_labor, jeea_index_services
r; t=0.00 12:48:30

. 
. /*==============================================================================
>   PART 3: ADDITIONAL GROUP INDICES (Groups H, M, N)
> ==============================================================================*/
. 
. di ""

r; t=0.00 12:48:30

. di "--- Building Group H/M/N indices ---"
--- Building Group H/M/N indices ---
r; t=0.00 12:48:30

. 
. * Group H — Discrimination index (higher = more discrimination)
. _jee_std_bywave discrim_ever         tmp_dis_ever
(13,580 missing values generated)
(8,218 real changes made)
(5,099 real changes made)
r; t=0.01 12:48:30

. _jee_std_bywave discrim_freq         tmp_dis_freq
(13,580 missing values generated)
(4,330 real changes made)
(2,325 real changes made)
r; t=0.01 12:48:30

. _jee_std_bywave discrim_nationality  tmp_dis_nat
(13,580 missing values generated)
(4,331 real changes made)
(2,325 real changes made)
r; t=0.01 12:48:30

. _jee_std_bywave discrim_skin         tmp_dis_skin
(13,580 missing values generated)
(4,331 real changes made)
(2,325 real changes made)
r; t=0.01 12:48:30

. _jee_std_bywave discrim_appearance   tmp_dis_app
(13,580 missing values generated)
(4,331 real changes made)
(2,325 real changes made)
r; t=0.01 12:48:30

. _jee_std_bywave discrim_accent       tmp_dis_acc
(13,580 missing values generated)
(4,331 real changes made)
(2,325 real changes made)
r; t=0.01 12:48:30

. _jee_std_bywave discrim_economic     tmp_dis_eco
(13,580 missing values generated)
(4,331 real changes made)
(2,325 real changes made)
r; t=0.01 12:48:30

. _jee_std_bywave discrim_gender       tmp_dis_gen
(13,580 missing values generated)
(4,331 real changes made)
(2,325 real changes made)
r; t=0.01 12:48:30

. _jee_std_bywave discrim_political    tmp_dis_pol
(13,580 missing values generated)
(4,331 real changes made)
(2,325 real changes made)
r; t=0.01 12:48:30

. egen index_discrim = rowmean(tmp_dis_ever tmp_dis_freq tmp_dis_nat tmp_dis_skin ///
>     tmp_dis_app tmp_dis_acc tmp_dis_eco tmp_dis_gen tmp_dis_pol)
(263 missing values generated)
r; t=0.02 12:48:30

. label var index_discrim "Discrimination index (control-std, higher = more)"
r; t=0.00 12:48:30

. drop tmp_dis_*
r; t=0.00 12:48:30

. 
. * Group M — Remittances index
. _jee_std_bywave remit_now            tmp_rm_now
(13,580 missing values generated)
(8,225 real changes made)
(5,341 real changes made)
r; t=0.01 12:48:30

. _jee_std_bywave remit_to_parents     tmp_rm_par
(13,580 missing values generated)
(6,232 real changes made)
(3,716 real changes made)
r; t=0.01 12:48:30

. _jee_std_bywave remit_to_siblings    tmp_rm_sib
(13,580 missing values generated)
(6,232 real changes made)
(3,716 real changes made)
r; t=0.01 12:48:30

. _jee_std_bywave remit_to_children    tmp_rm_chi
(13,580 missing values generated)
(6,232 real changes made)
(3,716 real changes made)
r; t=0.01 12:48:30

. _jee_std_bywave remit_to_spouse      tmp_rm_spo
(13,580 missing values generated)
(6,232 real changes made)
(3,716 real changes made)
r; t=0.01 12:48:30

. egen index_remit = rowmean(tmp_rm_now tmp_rm_par tmp_rm_sib tmp_rm_chi tmp_rm_spo)
(14 missing values generated)
r; t=0.01 12:48:30

. label var index_remit "Remittances index (control-std, higher = more remitting)"
r; t=0.00 12:48:30

. drop tmp_rm_*
r; t=0.00 12:48:30

. 
. * Group N — Financial access index
. _jee_std_bywave bank                 tmp_fa_bank
(13,580 missing values generated)
(8,202 real changes made)
(5,341 real changes made)
r; t=0.01 12:48:30

. _jee_std_bywave has_savings_account  tmp_fa_sav
(13,580 missing values generated)
(1,039 real changes made)
(902 real changes made)
r; t=0.01 12:48:30

. _jee_std_bywave has_mobile_money     tmp_fa_mob
(13,580 missing values generated)
(1,039 real changes made)
(902 real changes made)
r; t=0.01 12:48:30

. _jee_std_bywave savings_precovid     tmp_fa_pre
(13,580 missing values generated)
(8,201 real changes made)
(5,095 real changes made)
r; t=0.01 12:48:30

. egen index_fin_access = rowmean(tmp_fa_bank tmp_fa_sav tmp_fa_mob tmp_fa_pre)
(12 missing values generated)
r; t=0.01 12:48:30

. label var index_fin_access "Financial access index (control-std)"
r; t=0.00 12:48:30

. drop tmp_fa_*
r; t=0.00 12:48:30

. 
. * Group N — Digital integration index
. _jee_std_bywave has_smartphone       tmp_dg_phone
(13,580 missing values generated)
(8,229 real changes made)
r; t=0.01 12:48:30

. _jee_std_bywave has_internet         tmp_dg_int
(13,580 missing values generated)
(4,575 real changes made)
(3,014 real changes made)
r; t=0.01 12:48:30

. _jee_std_bywave has_data_plan        tmp_dg_data
(13,580 missing values generated)
(7,799 real changes made)
(5,110 real changes made)
r; t=0.01 12:48:30

. _jee_std_bywave internet_at_home     tmp_dg_home
(13,580 missing values generated)
(8,229 real changes made)
(5,347 real changes made)
r; t=0.01 12:48:30

. _jee_std_bywave apps_whatsapp        tmp_dg_wa
(13,580 missing values generated)
(8,229 real changes made)
(5,105 real changes made)
r; t=0.01 12:48:30

. _jee_std_bywave apps_facebook        tmp_dg_fb
(13,580 missing values generated)
(8,229 real changes made)
(5,105 real changes made)
r; t=0.01 12:48:30

. _jee_std_bywave apps_email           tmp_dg_em
(13,580 missing values generated)
(8,229 real changes made)
(5,105 real changes made)
r; t=0.01 12:48:30

. egen index_digital = rowmean(tmp_dg_phone tmp_dg_int tmp_dg_data tmp_dg_home ///
>     tmp_dg_wa tmp_dg_fb tmp_dg_em)
r; t=0.03 12:48:31

. label var index_digital "Digital integration index (control-std)"
r; t=0.00 12:48:31

. drop tmp_dg_*
r; t=0.00 12:48:31

. 
. di "  Added: index_discrim, index_remit, index_fin_access, index_digital"
  Added: index_discrim, index_remit, index_fin_access, index_digital
r; t=0.00 12:48:31

. 
. /*------------------------------------------------------------------------------
>   Composite indices: trust_index and mh_index.
>   Standardize each component within wave by the control-group mean and SD,
>   then average the standardized components. Built here so they persist in
>   the analysis sample and are visible to all downstream do-files.
> ------------------------------------------------------------------------------*/
. 
. * Mental-health composite (life_satisfaction + EQ-5D + 1-anx_depr + VAS).
. local mh_have = 1
r; t=0.00 12:48:31

. foreach src in life_satisfaction hi5_inv any_anx_depr vas_score {
  2.     capture confirm variable `src'
  3.     if _rc != 0 local mh_have = 0
  4. }
r; t=0.00 12:48:31

. if `mh_have' == 1 {
.     foreach src in life_satisfaction hi5_inv any_anx_depr vas_score {
  2.         capture drop _zmh_`src'
  3.         gen _zmh_`src' = .
  4.         forvalues w = 1/2 {
  5.             qui sum `src' if pep == 0 & wave_num == `w'
  6.             if r(N) > 0 & r(sd) != . & r(sd) > 0 {
  7.                 replace _zmh_`src' = (`src' - r(mean)) / r(sd) if wave_num == `w'
  8.             }
  9.         }
 10.     }
(13,580 missing values generated)
(8,223 real changes made)
(5,338 real changes made)
(13,580 missing values generated)
(8,223 real changes made)
(5,341 real changes made)
(13,580 missing values generated)
(8,223 real changes made)
(5,341 real changes made)
(13,580 missing values generated)
(8,226 real changes made)
(5,339 real changes made)
r; t=0.04 12:48:31
.     capture replace _zmh_any_anx_depr = -_zmh_any_anx_depr
r; t=0.00 12:48:31
.     * Create the empty placeholder BEFORE creating mh_index_raw so the
.     * capture-drop cannot abbreviation-match mh_index_raw (Stata's
.     * varabbrev expands "mh_index" to "mh_index_raw" when the exact name
.     * doesn't exist).
.     capture drop mh_index
r; t=0.00 12:48:31
.     gen mh_index = .
(13,580 missing values generated)
r; t=0.00 12:48:31
.     capture drop mh_index_raw
r; t=0.00 12:48:31
.     egen mh_index_raw = rowmean(_zmh_life_satisfaction _zmh_hi5_inv ///
>         _zmh_any_anx_depr _zmh_vas_score)
(10 missing values generated)
r; t=0.01 12:48:31
.     forvalues w = 1/2 {
  2.         qui sum mh_index_raw if pep == 0 & wave_num == `w'
  3.         if r(N) > 0 & r(sd) != . & r(sd) > 0 {
  4.             replace mh_index = (mh_index_raw - r(mean)) / r(sd) if wave_num == `w'
  5.         }
  6.     }
(8,229 real changes made)
(5,341 real changes made)
r; t=0.01 12:48:31
.     label var mh_index "Mental-health composite (life sat + EQ-5D + anx/depr + VAS) (SD)"
r; t=0.00 12:48:31
.     capture drop _zmh_*
r; t=0.00 12:48:31
.     capture drop mh_index_raw
r; t=0.00 12:48:31
. }
r; t=0.07 12:48:31

. 
. * Trust composite (general_trust + trust_col + trust_ven).
. local tr_have = 1
r; t=0.00 12:48:31

. foreach src in general_trust trust_col trust_ven {
  2.     capture confirm variable `src'
  3.     if _rc != 0 local tr_have = 0
  4. }
r; t=0.00 12:48:31

. if `tr_have' == 1 {
.     foreach src in general_trust trust_col trust_ven {
  2.         capture drop _ztr_`src'
  3.         gen _ztr_`src' = .
  4.         forvalues w = 1/2 {
  5.             qui sum `src' if pep == 0 & wave_num == `w'
  6.             if r(N) > 0 & r(sd) != . & r(sd) > 0 {
  7.                 replace _ztr_`src' = (`src' - r(mean)) / r(sd) if wave_num == `w'
  8.             }
  9.         }
 10.     }
(13,580 missing values generated)
(8,200 real changes made)
(5,084 real changes made)
(13,580 missing values generated)
(4,203 real changes made)
(2,557 real changes made)
(13,580 missing values generated)
(4,231 real changes made)
(2,570 real changes made)
r; t=0.03 12:48:31
.     * Create the empty placeholder BEFORE creating trust_index_raw so the
.     * capture-drop cannot abbreviation-match trust_index_raw.
.     capture drop trust_index
r; t=0.00 12:48:31
.     gen trust_index = .
(13,580 missing values generated)
r; t=0.00 12:48:31
.     capture drop trust_index_raw
r; t=0.00 12:48:31
.     egen trust_index_raw = rowmean(_ztr_general_trust _ztr_trust_col _ztr_trust_ven)
(282 missing values generated)
r; t=0.01 12:48:31
.     forvalues w = 1/2 {
  2.         qui sum trust_index_raw if pep == 0 & wave_num == `w'
  3.         if r(N) > 0 & r(sd) != . & r(sd) > 0 {
  4.             replace trust_index = (trust_index_raw - r(mean)) / r(sd) if wave_num == `w'
  5.         }
  6.     }
(8,213 real changes made)
(5,085 real changes made)
r; t=0.01 12:48:31
.     label var trust_index "Trust composite (general + col + ven) (SD)"
r; t=0.00 12:48:31
.     capture drop _ztr_*
r; t=0.00 12:48:31
.     capture drop trust_index_raw
r; t=0.00 12:48:31
. }
r; t=0.06 12:48:31

. 
. di "  Added: mh_index, trust_index"
  Added: mh_index, trust_index
r; t=0.00 12:48:31

. 
. /*==============================================================================
>   PART 4: SAVE
> ==============================================================================*/
. 
. label data "PEP analysis sample (JEEA-style + extended outcome indices)"
r; t=0.00 12:48:31

. compress
  (0 bytes saved)
r; t=0.06 12:48:31

. save "$clean/PEP_Analysis_Sample.dta", replace
file ../data/PEP_Analysis_Sample.dta saved
r; t=0.19 12:48:31

. di ""

r; t=0.00 12:48:31

. di "  Saved $clean/PEP_Analysis_Sample.dta"
  Saved ../data/PEP_Analysis_Sample.dta
r; t=0.00 12:48:31

. 
. /*==============================================================================
>   PART 5: VERIFY OUTCOMES BY GROUP, BUILD INVENTORY PDF
> ==============================================================================*/
. 
. di ""

r; t=0.00 12:48:31

. di "--- Verifying outcomes by group ---"
--- Verifying outcomes by group ---
r; t=0.00 12:48:31

. 
. * Define groups (mirrors the analysis-plan structure)
. local A     jeea_index_wellbeing index_wellbeing gasto_capita ///
>             labour_income income_maxhh employed
r; t=0.00 12:48:31

. local B     jeea_index_labor index_labor formal hora_semana ///
>             has_written_contract underemployed job_tenure ///
>             independent business_registered
r; t=0.00 12:48:31

. local C     jeea_index_services index_services sisben subs bank govtr ///
>             transfer_fa transfer_ja transfer_is transfer_bs aid_ngo_church
r; t=0.00 12:48:31

. local D     index_health health_pca vas_score anx_depr any_anx_depr ///
>             phys_problem chronic_illness got_healthcare paid_health ///
>             barrier_no_insurance
r; t=0.00 12:48:31

. local E     index_food skip_meals skip_meals_freq protein_days ///
>             went_without_food food_insecure_seek child_skip_meals
r; t=0.00 12:48:31

. local F     index_housing adequate_housing precarious_housing has_electricity ///
>             has_water has_sewage potable_water n_rooms n_bedrooms ///
>             persons_per_bedroom
r; t=0.00 12:48:31

. local G     index_integration belonging feel_integrated trust_local_govt ///
>             trust_national_govt general_trust col_friends community_org ///
>             connection_colombia feels_foreign meals_with_colombians ///
>             colombian_contacts
r; t=0.00 12:48:31

. local G2    trust_col colombians_help_me count_on_col trust_ven ///
>             venezuelans_help_me count_on_ven
r; t=0.00 12:48:31

. local H     index_discrim discrim_ever discrim_nationality discrim_skin ///
>             discrim_appearance discrim_accent discrim_economic ///
>             discrim_gender discrim_political discrim_freq filed_complaint ///
>             difficulty_legal_help difficulty_find_job
r; t=0.00 12:48:31

. local H2    perc_low_wages perc_no_rights perc_no_docs perc_employers_abuse ///
>             perc_no_other_option perc_prefer_informal perc_fear_deport ///
>             perc_labor_discrim
r; t=0.00 12:48:31

. local I     intend_stay intend_return intend_other plan_stay_5yr ///
>             expect_stay_5yr considered_return_ven wants_reunify
r; t=0.00 12:48:31

. local J     index_covid covid_income_down covid_income_same covid_return_ven ///
>             covid_eviction covid_moved covid_received_aid covid_discrimination ///
>             covid_borrowed_money covid_sold_assets covid_begged
r; t=0.00 12:48:31

. local K     currently_studying currently_enrolled current_enroll_level ///
>             degree_validated literate covid_study_interrupted ///
>             lost_job_no_homologation worked_without_title
r; t=0.00 12:48:31

. local L     child_worked child_hours child_skip_meals child_vaccinated ///
>             covid_study_interrupted currently_enrolled current_enroll_level ///
>             current_grade
r; t=0.00 12:48:31

. local M     index_remit remit_precovid remit_now remit_amount_precovid ///
>             remit_amount_lastmonth remit_to_parents remit_to_siblings ///
>             remit_to_children remit_to_spouse
r; t=0.00 12:48:31

. local N     index_fin_access index_digital bank has_savings_account ///
>             has_mobile_money savings_precovid has_smartphone has_internet ///
>             has_data_plan internet_at_home apps_whatsapp apps_facebook ///
>             apps_email internet_in_vz
r; t=0.00 12:48:31

. 
. local groups A B C D E F G G2 H H2 I J K L M N
r; t=0.00 12:48:31

. local title_A   "Economic well-being"
r; t=0.00 12:48:31

. local title_B   "Labor market"
r; t=0.00 12:48:31

. local title_C   "Services and rights"
r; t=0.00 12:48:31

. local title_D   "Health"
r; t=0.00 12:48:31

. local title_E   "Food security"
r; t=0.00 12:48:31

. local title_F   "Housing"
r; t=0.00 12:48:31

. local title_G   "Social integration and trust"
r; t=0.00 12:48:31

. local title_G2  "Perceived prosociality (sub-group of G)"
r; t=0.00 12:48:31

. local title_H   "Discrimination"
r; t=0.00 12:48:31

. local title_H2  "Perceived labor barriers (sub-group of H)"
r; t=0.00 12:48:31

. local title_I   "Migration intentions"
r; t=0.00 12:48:31

. local title_J   "COVID impacts"
r; t=0.00 12:48:31

. local title_K   "Education (adult)"
r; t=0.00 12:48:31

. local title_L   "Child outcomes"
r; t=0.00 12:48:31

. local title_M   "Remittances"
r; t=0.00 12:48:31

. local title_N   "Financial access and digital"
r; t=0.00 12:48:31

. 
. * First pass: collect status counts and write a tab-separated inventory log
. local present_total = 0
r; t=0.00 12:48:31

. local absent_total  = 0
r; t=0.00 12:48:31

. local degen_total   = 0
r; t=0.00 12:48:31

. 
. file open inv using "$out/03_OutcomeInventory.txt", write replace text
r; t=0.01 12:48:31

. file write inv "group" _tab "variable" _tab "status" _tab ///
>     "n_w1" _tab "mean_w1" _tab "n_w2" _tab "mean_w2" _newline
r; t=0.00 12:48:31

. 
. foreach g of local groups {
  2.     local vars : copy local `g'
  3.     foreach v of local vars {
  4.         capture confirm variable `v'
  5.         if _rc {
  6.             file write inv "`g'" _tab "`v'" _tab "ABSENT" _tab "" _tab "" _tab "" _tab "" _newline
  7.             local ++absent_total
  8.             continue
  9.         }
 10.         capture confirm numeric variable `v'
 11.         if _rc {
 12.             file write inv "`g'" _tab "`v'" _tab "STRING" _tab "" _tab "" _tab "" _tab "" _newline
 13.             continue
 14.         }
 15.         qui count if `v' != . & wave_num == 1
 16.         local n1 = r(N)
 17.         qui sum `v' if wave_num == 1
 18.         local m1 = r(mean)
 19.         qui count if `v' != . & wave_num == 2
 20.         local n2 = r(N)
 21.         qui sum `v' if wave_num == 2
 22.         local m2 = r(mean)
 23.         local status "OK"
 24.         if `n1' == 0 & `n2' == 0 {
 25.             local status "EMPTY"
 26.             local ++degen_total
 27.         }
 28.         else {
 29.             local ++present_total
 30.         }
 31.         local m1_str = ""
 32.         if `n1' > 0 local m1_str = string(`m1', "%6.3f")
 33.         local m2_str = ""
 34.         if `n2' > 0 local m2_str = string(`m2', "%6.3f")
 35.         file write inv "`g'" _tab "`v'" _tab "`status'" _tab "`n1'" _tab "`m1_str'" _tab "`n2'" _tab "`m2_str'"
>  _newline
 36.     }
 37. }
r; t=0.86 12:48:32

. file close inv
r; t=0.00 12:48:32

. 
. di ""

r; t=0.00 12:48:32

. di "  Inventory text written: $out/03_OutcomeInventory.txt"
  Inventory text written: ../outputs/03_OutcomeInventory.txt
r; t=0.00 12:48:32

. 
. * Compact summary PDF: just totals + a per-group count table
. putpdf clear
r; t=0.05 12:48:32

. putpdf begin, pagesize(letter)
r; t=0.01 12:48:32

. putpdf paragraph, halign(center)
r; t=0.04 12:48:32

. putpdf text ("Outcome Construction Summary"), bold font(, 16)
r; t=0.01 12:48:32

. putpdf paragraph, halign(center)
r; t=0.01 12:48:32

. putpdf text ("Built from PEP_Analysis_Sample.dta. Generated $S_DATE."), italic
r; t=0.00 12:48:32

. 
. putpdf paragraph
r; t=0.00 12:48:32

. putpdf text ("Verification status"), bold font(, 13)
r; t=0.00 12:48:32

. putpdf table sm = (4, 2), border(all)
r; t=0.02 12:48:32

. putpdf table sm(1,1) = ("Status"), bold
r; t=0.01 12:48:32

. putpdf table sm(1,2) = ("Count"), bold
r; t=0.00 12:48:32

. putpdf table sm(2,1) = ("Outcomes present and non-empty")
r; t=0.00 12:48:32

. putpdf table sm(2,2) = ("`present_total'")
r; t=0.00 12:48:32

. putpdf table sm(3,1) = ("Outcomes absent (variable not built)")
r; t=0.00 12:48:32

. putpdf table sm(3,2) = ("`absent_total'")
r; t=0.00 12:48:32

. putpdf table sm(4,1) = ("Outcomes empty (built but all missing)")
r; t=0.00 12:48:32

. putpdf table sm(4,2) = ("`degen_total'")
r; t=0.00 12:48:32

. 
. putpdf paragraph
r; t=0.01 12:48:32

. putpdf text ("New indices added in this step"), bold font(, 13)
r; t=0.00 12:48:32

. putpdf table ix = (8, 2), border(all)
r; t=0.00 12:48:32

. putpdf table ix(1,1) = ("Index"), bold
r; t=0.00 12:48:32

. putpdf table ix(1,2) = ("Components"), bold
r; t=0.00 12:48:32

. putpdf table ix(2,1) = ("jeea_index_wellbeing")
r; t=0.00 12:48:32

. putpdf table ix(2,2) = ("std consumption + std income + std employed (control-mean, by wave)")
r; t=0.00 12:48:32

. putpdf table ix(3,1) = ("jeea_index_labor")
r; t=0.00 12:48:32

. putpdf table ix(3,2) = ("std formal + std log hours")
r; t=0.00 12:48:32

. putpdf table ix(4,1) = ("jeea_index_services")
r; t=0.00 12:48:32

. putpdf table ix(4,2) = ("std sisben + std subs + std bank + std govtr")
r; t=0.00 12:48:32

. putpdf table ix(5,1) = ("index_discrim")
r; t=0.00 12:48:32

. putpdf table ix(5,2) = ("9 discrimination items (Group H)")
r; t=0.00 12:48:32

. putpdf table ix(6,1) = ("index_remit")
r; t=0.00 12:48:32

. putpdf table ix(6,2) = ("5 remittance items (Group M)")
r; t=0.00 12:48:32

. putpdf table ix(7,1) = ("index_fin_access")
r; t=0.00 12:48:32

. putpdf table ix(7,2) = ("4 financial-access items (Group N)")
r; t=0.00 12:48:32

. putpdf table ix(8,1) = ("index_digital")
r; t=0.00 12:48:32

. putpdf table ix(8,2) = ("7 digital-integration items (Group N)")
r; t=0.00 12:48:32

. 
. putpdf paragraph
r; t=0.00 12:48:32

. putpdf text ("Per-variable details: see "), font(, 10)
r; t=0.00 12:48:32

. putpdf text ("03_OutcomeInventory.txt"), font("Courier", 10)
r; t=0.00 12:48:32

. 
. putpdf save "$out/03_OutcomeInventory.pdf", replace
successfully created "C:/Users/wb614536/Downloads/replication/replication/outputs/03_OutcomeInventory.pdf"
r; t=0.02 12:48:32

. 
. * Short LaTeX summary
. file open tex using "$out/03_OutcomeInventory.tex", write replace
r; t=0.01 12:48:32

. file write tex "\documentclass[11pt]{article}\usepackage[margin=1in]{geometry}\usepackage{booktabs}" _n
r; t=0.00 12:48:32

. file write tex "\title{Outcome Inventory by Group}\author{Sandra Rozo}\date{\today}\begin{document}\maketitle" _n
r; t=0.00 12:48:32

. file write tex "\begin{tabular}{lr}\toprule" _n
r; t=0.00 12:48:32

. file write tex "Outcomes present and non-empty & `present_total' \\" _n
r; t=0.00 12:48:32

. file write tex "Outcomes absent (not built)    & `absent_total' \\" _n
r; t=0.00 12:48:32

. file write tex "Outcomes empty (all missing)   & `degen_total' \\\bottomrule\end{tabular}" _n
r; t=0.00 12:48:32

. file write tex "\par See 03\_OutcomeInventory.pdf for the full per-variable table." _n
r; t=0.00 12:48:32

. file write tex "\end{document}" _n
r; t=0.00 12:48:32

. file close tex
r; t=0.00 12:48:32

. 
. di ""

r; t=0.00 12:48:32

. di "  PDF saved: $out/03_OutcomeInventory.pdf"
  PDF saved: ../outputs/03_OutcomeInventory.pdf
r; t=0.00 12:48:32

. di "  Outcomes present: `present_total'  absent: `absent_total'  empty: `degen_total'"
  Outcomes present: 148  absent: 0  empty: 1
r; t=0.00 12:48:32

. di "  Done."
  Done.
r; t=0.00 12:48:32

. 
. log close
      name:  <unnamed>
       log:  C:\Users\wb614536\Downloads\replication\replication\code\../outputs/03_OutcomeConstruction_log.txt
  log type:  text
 closed on:  25 Jun 2026, 12:48:32
--------------------------------------------------------------------------------------------------------------------
